namespace PortalBusiness.Migrations
{
    using System;
    using System.Data.Entity;
    using System.Data.Entity.Migrations;
    using System.Linq;

    internal sealed class Configuration : DbMigrationsConfiguration<PortalBusiness.Models.PortalBusinessContext>
    {
        public Configuration()
        {
            AutomaticMigrationsEnabled = true;
            AutomaticMigrationDataLossAllowed = true;
            ContextKey = "PortalBusiness.Models.PortalBusinessContext";
        }

        protected override void Seed(PortalBusiness.Models.PortalBusinessContext context)
        {
            if (context.NATUREZAs.Count() == 0)
            {
                context.NATUREZAs.Add(new Models.NATUREZASTART() { CODIGO = "01", DESCRICAO = "NATUREZA O1" });
                context.NATUREZAs.Add(new Models.NATUREZASTART() { CODIGO = "02", DESCRICAO = "NATUREZA O2" });
                context.NATUREZAs.Add(new Models.NATUREZASTART() { CODIGO = "03", DESCRICAO = "NATUREZA O3" });
                context.NATUREZAs.Add(new Models.NATUREZASTART() { CODIGO = "04", DESCRICAO = "NATUREZA O4" });
            }

            if (context.COLUNAs.Count() == 0)
            {
                context.COLUNAs.Add(new Models.COLUNA() { CODIGO = "DINHEIRO", NOME = "DINHEIRO", ATIVO = true });
                context.COLUNAs.Add(new Models.COLUNA() { CODIGO = "MOEDA", NOME = "MOEDA", ATIVO = true });
                context.COLUNAs.Add(new Models.COLUNA() { CODIGO = "00000101", NOME = "AMEX", ATIVO = true });
                context.COLUNAs.Add(new Models.COLUNA() { CODIGO = "00000201", NOME = "SODEXO", ATIVO = true });
            }


            //  This method will be called after migrating to the latest version.

            //  You can use the DbSet<T>.AddOrUpdate() helper extension method 
            //  to avoid creating duplicate seed data. E.g.
            //
            //    context.People.AddOrUpdate(
            //      p => p.FullName,
            //      new Person { FullName = "Andrew Peters" },
            //      new Person { FullName = "Brice Lambson" },
            //      new Person { FullName = "Rowan Miller" }
            //    );
            //
        }
    }
}
